#include "widget.h"
#include "ui_widget.h"


Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    mypushbotton = new QPushButton(this);
    mypushbotton->setText("hello world");
    mypushbotton->move(350,250);
    connect(mypushbotton,&QPushButton::clicked,this,&Widget::handleClick);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClick()
{
    //按钮被点击，则切换文本
    if(mypushbotton->text() == QString("hello world"))
        mypushbotton->setText("hello QT");
    else
        mypushbotton->setText("hello world");
}
